package com.digitalart.futbol.hibernate.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.digitalart.futbol.hibernate.dao.ReservacionDao;
import com.digitalart.futbol.hibernate.ejb.Reservacion;
import com.digitalart.futbol.hibernate.service.ReservacionService;

@Service
public class ReservacionServiceImpl implements ReservacionService {

	@Autowired(required=true)
	private ReservacionDao reservacionDao;
	
	
	@Transactional
	public Reservacion retriveReservacion(int id) {
		Reservacion result = this.reservacionDao.findById(id);
		return result;
	}

	@Transactional
	public Reservacion createReservacion(Reservacion reservacion) {
		Reservacion result = this.reservacionDao.persistOnMerge(reservacion);
		return result;
	}

	@Transactional
	public List<Reservacion> getAll() {
		List<Reservacion> result = this.reservacionDao.getAll();
		return result;
	}
	
}
